/*
 * Copyright 2010 Georgia Institute of Technology. All rights reserved.
 * Author: Karthik Narayan
 * 
 * Preferences.java: application configurations for the convex hull package
 * which allow cross-platform compatibility.
 */
package edu.gatech.cc.liam.geometry.linear.convexhull;

import java.io.File;
import java.util.Random;

import edu.gatech.cc.liam.core.Globals;

public class Preferences {

	public static final double TOLERANCE = Globals.TOLERANCE;

	public static final String QHULL_LOCATION =
		"E:\\Users\\Liam\\Documents\\programming\\eclipse\\includes\\qhull-2010.1";

	/** The location for QHull. */

	/** The file separator character. */
	public static final String fileSeparator;

	/** The operating system. */
	public static final String osName;

	/** The location for QHull. */
	//  public static final String QHULL_LOCATION;

	/** The executable for QConvex. */
	public static final String QCONVEX_EXECUTABLE;

	/** The executable for QHalf. */
	public static final String QHALF_EXECUTABLE;

	/** Initialize operating system information */
	static {

		// Set operating system information
		osName = System.getProperty("os.name");
		fileSeparator = File.separator;

		//    QHULL_LOCATION = String.format("..%sincludes%sqhull-2010.1",
		//        Preferences.fileSeparator, Preferences.fileSeparator);

		QCONVEX_EXECUTABLE = isLinux() ? "qconvex" : isWindows() ? "qconvex.exe" :
			"[UNKNOWN OS - " + osName + "]";
		QHALF_EXECUTABLE = isLinux() ? "qhalf" : isWindows() ? "qhalf.exe" :
			"[UNKNOWN OS - " + osName + "]";
	}

	/**
	 * Checks if the operating system is Linux.
	 *
	 * @return true, if is linux
	 */
	public static boolean isLinux() {
		return Preferences.osName.startsWith("Linux");
	}

	/**
	 * Checks if the operating system is Windows.
	 *
	 * @return true, if is windows
	 */
	public static boolean isWindows() {
		return Preferences.osName.startsWith("Windows");
	}
}
